The BIOS gets this information through device drivers. These small programs supplement its "communication recipes" and allow it to provide "new" recipes to the CPU for newer peripheral devices.
Why does your PC have a BIOS chip filled with instructions that contain all the low-level communications tasks that the CPU can use? It's simple. If you let someone else remember all the little details, it frees you up to get the more important work done. And so it is with the CPU.